package com.cs.bd.ad.self;

import android.content.Context;
import android.text.TextUtils;

import com.cs.bd.ad.AdSdkApi;

public class AdIdHelper {

    public static final String DEBUG_BIG = "2cae1a1f63f60185630f78a1d63923b0";

    public static final String DEBUG_SIMLE = "0c220d9bf7029e71461f247485696d07";

    private static final String DEBUG_ID = "2882303761517411490";

    public static String getXmAppId(Context context) {
        for (ProductId productId : ProductId.values()) {
            if (productId.mPackageName.equals(context.getPackageName())) {
                if (TextUtils.isEmpty(productId.mXmId)) {
                    break;
                }
                return productId.mXmId;
            }
        }
        if (AdSdkApi.sDebug) {
            return DEBUG_ID;
        }
        return "2882303761517774085";
    }

    public static String getWapsAppId(Context context) {
        for (ProductId productId : ProductId.values()) {
            if (productId.mPackageName.equals(context.getPackageName())) {
                if (TextUtils.isEmpty(productId.mWapsId)) {
                    break;
                }
                return productId.mWapsId;
            }
        }
        return "e2d567d5344354a111ffe5db5f16bc45";
    }

    public static String getStatisticsAppKey(Context context) {
        for (ProductId productId : ProductId.values()) {
            if (productId.mPackageName.equals(context.getPackageName())) {
                if (TextUtils.isEmpty(productId.mStatisticsId)) {
                    break;
                }
                return productId.mStatisticsId;
            }
        }
        return "5af3a6b8f43e48405200012b";
    }

    public static boolean isCalculator(Context context) {
        return ProductId.Calculator.mPackageName.equals(context.getPackageName());
    }

    public static boolean isScanner(Context context) {
        return ProductId.Scanner.mPackageName.equals(context.getPackageName());
    }

    public static boolean isColorPhone(Context context) {
        return ProductId.ColorPhone.mPackageName.equals(context.getPackageName());
    }

    public static boolean isManFit(Context context) {
        return ProductId.ManFit.mPackageName.equals(context.getPackageName());
    }

    public enum ProductId {

        Calculator("com.calculator.scientific.math", "e2d567d5344354a111ffe5db5f16bc45", "2882303761517774085", "5ad83d2eb27b0a36740000b5"),

        Scanner("com.scan.superpro", "74c1c5519cd7fd50e7b209c2bedfb94f", "2882303761517775766", "5aea668ea40fa35d930000a5"),

        ColorPhone("com.phone.call.flash.light", "", "2882303761517787029", "5af3a6b8f43e48405200012b"),

        ManFit("com.fitness.workout.exercise", "131fde35a2aa3105e76e0d230ec7bec2", "2882303761517774074", "5af8efa7b27b0a5475000032");

        private String mPackageName;

        private String mWapsId;

        private String mXmId;

        private String mStatisticsId;

        ProductId(String mPackageName, String mWapsId, String mXmId, String mStatisticsId) {
            this.mPackageName = mPackageName;
            this.mWapsId = mWapsId;
            this.mXmId = mXmId;
            this.mStatisticsId = mStatisticsId;
        }


    }


}
